home *** CD-ROM | disk | FTP | other *** search
/ com!online 2005 May / com_0505_1.iso / opensource / top10 / amc_install.exe / {app} / Scripts / DVDWorld (BR).ifs < prev    next >
Encoding:
Text File  |  2005-01-02  |  6.3 KB  |  225 lines

  1. // GETINFO SCRIPTING
  2. // http://dvdworld.com.br/
  3. // Script modificado por O Guardiπo versπo 1.0
  4. // 02-01-2005
  5.  
  6.  
  7. (***************************************************
  8.  *  For use with Ant Movie Catalog 3.4.0           *
  9.  *  www.antp.be/software/moviecatalog              *
  10.  *                                                 *
  11.  *  The source code of the script can be used in   *
  12.  *  another program only if full credits to        *
  13.  *  script author and a link to Ant Movie Catalog  *
  14.  *  website are given in the About box or in       *
  15.  *  the documentation of the program               *
  16.  *                                                 *
  17.  *  Please dont remove credits                     *
  18.  *  Reportem os erros para bruno_mga@hotmail.com   *
  19.  ***************************************************)
  20. program dvdworld;
  21. const
  22.   BaseAddress = 'http://dvdworld.com.br/dvdworld.hts';
  23.   ManualPictureSelect = True;
  24.   ExternalPictures = False;
  25.   DescriptionToImport = 2;
  26. var
  27.   MovieName: string;
  28.   MovieURL: string;
  29. function HTMLRemove(Value: String): String;
  30. begin
  31.   HTMLDecode(Value);
  32.   HTMLRemoveTags(Value);
  33.   Value := Trim(Value);
  34.   result := Value;
  35. end;
  36.  
  37. function UpFirstLetterWord(texto:string):string; //Function Made By O Guardiπo
  38. var espaco:integer;
  39.  sst:string;
  40. begin
  41. texto:=AnsiUpFirstLetter(AnsiLowerCase(texto));
  42. repeat
  43.     espaco:=Pos(' ',texto);
  44.     sst:=AnsiUpperCase(Copy(texto,espaco+1,1));
  45.     texto:=Copy(texto,1,espaco-1)+'/|\'+sst+Copy(texto,espaco+2,length(texto));
  46. until Pos(' ',texto)=0;
  47. texto := StringReplace(texto, '/|\', ' ');
  48. if Copy(texto,1,1)=' ' then
  49.   texto:=Copy(texto,2,length(texto));
  50. result:=texto;
  51. end;
  52.  
  53. procedure AnalyzeFilmPage(Address: String);
  54. var
  55.   Page : TStringList;
  56.   Line, Value : string;
  57.   LineNr, BeginPos, EndPos: Integer;
  58.   AllTitles: TStringList;
  59.   url_imdb:string;
  60.   nome_orig:string;
  61.   nome_trad:string;
  62.   pais:string;
  63.   genero:string;
  64.   realizac:string;
  65.   Interpretes:string;
  66.   descricao:string;
  67.   capa:string;
  68. begin
  69.   Page := TStringList.Create;
  70.   value := 'http://216.247.85.101/images/'+Address+'.jpg';
  71.   // (it is working well)
  72.   GetPicture(Value, False);
  73.   Address:='http://dvdworld.com.br/dvdworld.hts?+'+Address+'+acha';
  74.   Page.Text := GetPage(Address);
  75.   SetField(fieldURL, Address);
  76.  
  77.   LineNr := FindLine('Tφtulo Original:', Page, 0);
  78.   if LineNr<>-1 then
  79.   begin
  80.     Value := Page.GetString(LineNr);
  81.     BeginPos := pos('/b>',value);
  82.     EndPos := pos(' - ',value)-3;
  83.     nome_orig:=copy(value,BeginPos+3,EndPos-BeginPos);    
  84.     nome_orig:=HTMLRemove(nome_orig);
  85.     SetField(fieldOriginalTitle, nome_orig);
  86.   end;
  87.  
  88.   LineNr := FindLine('<td  align="left" valign="top"><font face="Arial, Helvetica, sans-serif" size="4" color="#000066"><b>', Page, 0);
  89.   if LineNr<>-1 then
  90.   begin
  91.     Value := Page.GetString(LineNr);
  92.     nome_trad:=HTMLRemove(Value);
  93.     nome_trad:=UpFirstLetterWord(nome_trad);
  94.     SetField(fieldTranslatedTitle, nome_trad);
  95.   end;
  96.  
  97.   LineNr := FindLine('<b>Diretor:</b>', Page, 0);
  98.   if LineNr<>-1 then
  99.   begin
  100.     Value := Page.GetString(LineNr);
  101.     BeginPos := pos('/b>',value);
  102.     EndPos := pos('</f',value);
  103.     realizac:=copy(value,BeginPos+3,EndPos);    
  104.     realizac:=HTMLRemove(realizac);                      
  105.     SetField(fieldDirector, realizac);
  106.   end;
  107.  
  108.   LineNr := FindLine('Atores: </b>', Page, 0);
  109.   if LineNr<>-1 then
  110.   begin
  111.     Value := Page.GetString(LineNr);
  112.     BeginPos := pos('/b>',value);
  113.     EndPos := pos('</f',value);
  114.     Interpretes:=copy(value,BeginPos+3,EndPos);    
  115.     Interpretes:=HTMLRemove(Interpretes);                      
  116.     SetField(fieldActors, Interpretes);
  117.   end;
  118.  
  119.   LineNr := FindLine('GÊNERO', Page, 0)+4;
  120.   if LineNr<>4 then
  121.   begin
  122.     value:=HTMLRemove(Page.GetString(LineNr));
  123.     SetField(fieldCategory, value);
  124.   end;
  125.  
  126.   LineNr := FindLine('DE PRODUÇÃ', Page, 0)+4;
  127.   if LineNr<>4 then
  128.   begin
  129.     value:=HTMLRemove(Page.GetString(LineNr));
  130.     SetField(fieldYear, value);
  131.   end;
  132.  
  133.   LineNr := FindLine('DURAÇÃ', Page, 0)+5;
  134.   if LineNr<>5 then
  135.   begin
  136.     value:=HTMLRemove(Page.GetString(LineNr));
  137.     SetField(fieldLength, value);
  138.   end;
  139.   
  140.   LineNr := FindLine('<b>ESTUDIO</b>', Page, 0)+4;
  141.   if LineNr<>4 then
  142.   begin
  143.     value:=HTMLRemove(Page.GetString(LineNr));
  144.     SetField(fieldProducer, value);
  145.   end;
  146.  
  147.   LineNr := FindLine('<b>Sinopse:</b>', Page, 0);
  148.   if LineNr<>-1 then
  149.   begin
  150.     Value := Page.GetString(LineNr);
  151.     BeginPos := pos('/b>',value);
  152.     EndPos := pos('</f',value);
  153.     descricao:=copy(value,BeginPos+3,EndPos);    
  154.     descricao:=HTMLRemove(descricao);                      
  155.     SetField(fieldDescription, descricao);
  156.   end;
  157.  
  158. end;
  159.  
  160.  
  161.  
  162. function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
  163. var
  164.   i: Integer;
  165. begin
  166.   result := -1;
  167.   if StartAt < 0 then
  168.     StartAt := 0;
  169.   for i := StartAt to List.Count-1 do
  170.     if Pos(Pattern, List.GetString(i)) <> 0 then
  171.     begin
  172.       result := i;
  173.       Break;
  174.     end;
  175. end;
  176.  
  177. procedure AnalyzePage(Address: string);
  178. var
  179.   Page: TStringList;
  180.   LineNr, StartPos, EndPos: Integer;
  181.   Line: string;
  182.   x:integer;
  183.   MovieAddress, findMovieName,linedown : string;
  184.   guardar,url, nome_filme:string;
  185. begin
  186.   PickTreeClear;
  187.   Page := TStringList.Create;
  188.   Page.Text := GetPage(Address);
  189.  
  190.   if (pos('tφtulos que contΘm a palavra chave', Page.Text)>0) and (pos('Nada achado!.', Page.Text) = 0) then
  191.    begin
  192.     LineNr :=0;
  193.     repeat
  194.       LineNr := FindLine('+acha', Page, LineNr);
  195.       If LineNr >0 Then Begin
  196.         Line := Page.GetString(LineNr);
  197.         StartPos := pos('hts?+', Line)+1;
  198.         url:=(copy(line,StartPos+4,7));
  199.         EndPos := pos('</A>',Line)-1;
  200.         Line := copy(Line, StartPos+18, EndPos);
  201.         Line:=  HTMLRemove(Line);
  202.         nome_filme:=Line;
  203.         PickTreeAdd(nome_filme, url);
  204.         LineNr := LineNr + 1;
  205.       End;
  206.     until (LineNr<1);
  207.     if PickTreeExec(Address) then begin
  208.     AnalyzeFilmPage(Address);
  209.    end;
  210.    Page.Free;
  211.    DisplayResults;
  212.     end
  213.     else
  214.        ShowMessage('Nada achado!')
  215. end;
  216.  
  217. begin
  218.   PickListClear;
  219.   MovieName := GetField(fieldOriginalTitle);
  220.   if Input('Importar do DVDWorld', 'Escreva o nome do filme:', MovieName) then begin
  221.   MovieName := StringReplace(MovieName, ' ', '%20');
  222.   AnalyzePage('http://dvdworld.com.br/dvdworld.hts?+search+'+MovieName+'+titulo');
  223.   end;
  224. end.
  225.